<%-
  ucid = channel.ucid
  author = HTML.escape(channel.author)
  channel_profile_pic = URI.parse(channel.author_thumbnail).request_target

  relative_url = "/channel/#{ucid}/community"
  youtube_url = "https://www.youtube.com#{relative_url}"
  redirect_url = Invidious::Frontend::Misc.redirect_url(env)

  selected_tab = Invidious::Frontend::ChannelPage::TabsAvailable::Posts
-%>

<% content_for "header" do %>
<link rel="alternate" href="<%= youtube_url %>">
<title><%= author %> - Invidious</title>
<% end %>

<%= rendered "components/channel_info" %>

<div class="h-box">
    <hr>
</div>

<% if error_message %>
    <div class="h-box">
        <p><%= error_message %></p>
    </div>
<% else %>
    <div class="h-box pure-g comments" id="comments">
        <%= IV::Frontend::Comments.template_youtube(items.not_nil!, locale, thin_mode) %>
    </div>
<% end %>

<script id="community_data" type="application/json">
<%=
{
    "ucid" => ucid,
    "youtube_comments_text" => HTML.escape(translate(locale, "View YouTube comments")),
    "comments_text" => HTML.escape(translate(locale, "View `x` comments", "{commentCount}")),
    "hide_replies_text" => HTML.escape(translate(locale, "Hide replies")),
    "show_replies_text" => HTML.escape(translate(locale, "Show replies")),
    "preferences" => env.get("preferences").as(Preferences)
}.to_pretty_json
%>
</script>
<script src="/js/community.js?v=<%= ASSET_COMMIT %>"></script>
